#ifndef RECORDER_H
#define RECORDER_H

#include <QObject>
#include <QFile>
#include <QTime>
#include <QTimer>


extern int PSU;
extern float TEM;


class recorder : public QObject
{
    Q_OBJECT
public:
    explicit recorder(QObject *parent = 0);

    void clear();
    void stage_cut(uchar n);
    void auto_record();
    void stop_auto_record();
    void save();
    void realtime_print();


//    struct record2char//
//    {
//        char currenttime[12];//以'\0'结尾
//        char termperature[8];
//        char pressure[8];
//    }r2c[100];

    struct record//
    {
        QTime currenttime;//以'\0'结尾
        float termperature;
        int pressure;
    }rec[100];

    QString starttime;
signals:

public slots:
    void record();

private:
    QFile doc;
    QTimer* timer;
    QTextCodec* codec1;
    void print_header();
    void print_error();
    void print_sterilization_data();
    void end_print();
    void open_record_file();
    uint i;
    uint rn;
    uchar cut[8];
    bool print_type_tmp;
};

#endif // RECORDER_H
